home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / bstfiles.zoo / chicagoa.bst (.txt) < prev    next >
LaTeX Document  |  1992-08-05  |  36KB  |  1,325 lines

  1. %$$$ chicagoa.bst $$$
  2. % "Chicago" BibTeX style, chicagoa.bst - Chicago style with annotations
  3. % =====================================================================
  4. % BibTeX `chicagoa' style file for BibTeX version 0.99c, LaTeX version 2.09
  5. % Place it in a file called chicagoa.bst in the BibTeX search path.
  6. % You need to include chicago.sty as a \documentstyle option.
  7. % (Placing it in the same directory as the LaTeX document should also work.)
  8. % This "chicago" style is based on newapa.bst (American Psych. Assoc.)
  9. % found at ymir.claremont.edu. Annotation support added 07/09/92.
  10. % Modifications are loosely based on Chicago Manual of Style.
  11. %   Citation format: (author-last-name year)
  12. %             (author-last-name and author-last-name year)
  13. %             (author-last-name, author-last-name, and author-last-name year)
  14. %             (author-last-name et al. year)
  15. %             (author-last-name)
  16. %             author-last-name (year)
  17. %             (author-last-name and author-last-name)
  18. %             (author-last-name et al.)
  19. %             (year) or (year,year)
  20. %             year or year,year
  21. %   Reference list ordering: alphabetical by author or whatever passes
  22. %    for author in the absence of one.
  23. % This BibTeX style has support for abbreviated author lists and for
  24. %    year-only citations.  This is done by having the citations
  25. %    actually look like
  26. %    \citeauthoryear{full-author-info}{abbrev-author-info}{year}
  27. % The LaTeX style has to have the following (or similar)
  28. %     \let\@internalcite\cite
  29. %     \def\fullcite{\def\citeauthoryear##1##2##3{##1, ##3}\@internalcite}
  30. %     \def\fullciteA{\def\citeauthoryear##1##2##3{##1}\@internalcite}
  31. %     \def\shortcite{\def\citeauthoryear##1##2##3{##2, ##3}\@internalcite}
  32. %     \def\shortciteA{\def\citeauthoryear##1##2##3{##2}\@internalcite}
  33. %     \def\citeyear{\def\citeauthoryear##1##2##3{##3}\@internalcite}
  34. % These TeX macro definitions are found in chicago.sty. Additional
  35. % commands to manipulate different components of a citation can be defined
  36. % so that, for example, you can list author's names without parentheses
  37. % if using a citation as a noun or object in a sentence.
  38. % This file was originally copied from newapa.bst at ymir.claremont.edu.
  39. % Features of chicagoa.bst:
  40. % =========================
  41. % - supports an "annotation" field for annotated bibliographies.
  42. % - full names used in citations, but abbreviated citations are available
  43. %   (see above)
  44. % - if an entry has a "month", then the month and year are also printed
  45. %   as part of that reference item.
  46. % - book, inbook and manual use "location: publisher" (or organization)
  47. %   for address and publisher. All other types list publishers separately.
  48. % - "pp." are used to identify page numbers for all entry types except
  49. %   articles.
  50. % - organization is used as a citation label if neither author nor editor
  51. %   is present (for manuals).
  52. % - "et al." is used for long author and editor lists.
  53. % Modified by Glenn Paulley, University of Waterloo, July, 1992 (mostly
  54. % from Chicago Manual of Style):
  55. % Modifications: (from newapa.bst)
  56. % =============
  57. %   - added month, year to bib entries if month is present
  58. %   - fixed bug with In proceedings, added necessary comma after title
  59. %   - all conjunctions changed to "and" from "\&"
  60. %   - fixed bug with author labels in my.full.label: "et al." now is
  61. %        generated when "others" is an author name
  62. %   - major modification from Chicago Manual of Style (13th ed.) is that
  63. %     only the first author in a reference appears last name first-
  64. %     additional authors appear as J. Q. Public.
  65. %   - pages are listed as "pp. xx-xx" in all entry types, except
  66. %     article entries. Unnecessary (IMHO) "()" around page numbers
  67. %     were removed, and page numbers now don't end with a period.
  68. %   - created chicago.sty for use with this bibstyle (required).
  69. %   - fixed bugs in FUNCTION {format.vol.num.pages} for missing volume,
  70. %     number, and /or pages. Renamed to format.jour.vol.
  71. %   - fixed bug in formatting booktitles: additional period an error if
  72. %     book has a volume.
  73. %   - fixed bug: editors usually given redundant period before next clause
  74. %     (format.editors.dot) removed.
  75. %   - added label support for organizations, if both author and editor
  76. %     are missing (from alpha.bst). If organization is too long, then
  77. %     the key field is used for abbreviated citations.
  78. %   - In proceedings or books of several volumes, no comma was written
  79. %     between the "Volume x" and the page numbers (this was intentional
  80. %     in newapa.bst). Fixed.
  81. %   - Some journals may not have volumes/numbers, only month/year (eg.
  82. %     IEEE Computer). Fixed bug in article style that assumed volume/number
  83. %     was always present.
  84. % Original documentation for newapa.sty:
  85. % =====================================
  86. % This version was made by modifying the master file made by
  87. % Oren Patashnik (PATASHNIK@SCORE.STANFORD.EDU), and the 'named' BibTeX
  88. % style of Peter F. Patel-Schneider.
  89. % Copyright (C) 1985, all rights reserved.
  90. % Copying of this file is authorized only if either
  91. % (1) you make absolutely no changes to your copy, including name, or
  92. % (2) if you do make changes, you name it something other than 'newapa.bst'.
  93. % There are undoubtably bugs in this style.  If you make bug fixes,
  94. % improvements, etc.  please let me know.  My e-mail address is:
  95. %    spencer@cgrg.ohio.state.edu or 71160.3141@compuserve.com
  96. % This style was made from 'plain.bst', 'named.bst', and 'apalike.bst',
  97. % with lots of tweaking to make it look like APA style, along with tips
  98. % from Young Ryu and Brian Reiser's modifications of 'apalike.bst'.
  99. ENTRY
  100.   { address
  101.     annotation
  102.     author
  103.     booktitle
  104.     chapter
  105.     edition
  106.     editor
  107.     howpublished
  108.     institution
  109.     journal
  110.     key
  111.     month
  112.     note
  113.     number
  114.     organization
  115.     pages
  116.     publisher
  117.     school
  118.     series
  119.     title
  120.     type
  121.     volume
  122.     year
  123.   { label extra.label sort.label }
  124. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  125. FUNCTION {init.state.consts}
  126. { #0 'before.all :=
  127.   #1 'mid.sentence :=
  128.   #2 'after.sentence :=
  129.   #3 'after.block :=
  130. STRINGS { s t u }
  131. FUNCTION {output.nonnull}
  132. { 's :=
  133.   output.state mid.sentence =
  134.     { ", " * write$ }
  135.     { output.state after.block =
  136.     { add.period$ write$
  137.       newline$
  138.       "\newblock " write$
  139.     }
  140.     { output.state before.all =
  141.         'write$
  142.         { add.period$ " " * write$ }
  143.       if$
  144.     }
  145.       if$
  146.       mid.sentence 'output.state :=
  147.     }
  148.   if$
  149. % Use a colon to separate output. Used only for address/publisher
  150. % combination in book/inbook types.
  151. FUNCTION {output.nonnull.colon}
  152. { 's :=
  153.   output.state mid.sentence =
  154.     { ": " * write$ }
  155.     { output.state after.block =
  156.     { add.period$ write$
  157.       newline$
  158.       "\newblock " write$
  159.     }
  160.     { output.state before.all =
  161.         'write$
  162.         { add.period$ " " * write$ }
  163.       if$
  164.     }
  165.       if$
  166.       mid.sentence 'output.state :=
  167.     }
  168.   if$
  169. FUNCTION {output}
  170. { duplicate$ empty$
  171.     'pop$
  172.     'output.nonnull
  173.   if$
  174. FUNCTION {output.check}
  175. { 't :=
  176.   duplicate$ empty$
  177.     { pop$ "empty " t * " in " * cite$ * warning$ }
  178.     'output.nonnull
  179.   if$
  180. FUNCTION {output.colon}
  181. { duplicate$ empty$
  182.     'pop$
  183.     'output.nonnull.colon
  184.   if$
  185. FUNCTION {output.check.colon}
  186. { 't :=
  187.   duplicate$ empty$
  188.     { pop$ "empty " t * " in " * cite$ * warning$ }
  189.     'output.nonnull.colon
  190.   if$
  191. FUNCTION {output.year.check}
  192. { year empty$
  193.      { "empty year in " cite$ * warning$ }
  194.      { write$
  195.         " (" year * extra.label *
  196.        month empty$
  197.           { ")" * }
  198.           { ", " * month * ")" * }
  199.        if$
  200.        mid.sentence 'output.state :=
  201.      }
  202.   if$
  203. FUNCTION {output.bibitem}
  204. { newline$
  205.   "\bibitem[" write$
  206.   label write$
  207.   "]{" write$
  208.   cite$ write$
  209.   "}" write$
  210.   newline$
  211.   before.all 'output.state :=
  212. FUNCTION {fin.entry}
  213. { add.period$
  214.   write$
  215.   newline$
  216. FUNCTION {new.block}
  217. { output.state before.all =
  218.     'skip$
  219.     { after.block 'output.state := }
  220.   if$
  221. FUNCTION {new.sentence}
  222. { output.state after.block =
  223.     'skip$
  224.     { output.state before.all =
  225.     'skip$
  226.     { after.sentence 'output.state := }
  227.       if$
  228.     }
  229.   if$
  230. FUNCTION {not}
  231. {   { #0 }
  232.     { #1 }
  233.   if$
  234. FUNCTION {and}
  235. {   'skip$
  236.     { pop$ #0 }
  237.   if$
  238. FUNCTION {or}
  239. {   { pop$ #1 }
  240.     'skip$
  241.   if$
  242. FUNCTION {new.block.checka}
  243. { empty$
  244.     'skip$
  245.     'new.block
  246.   if$
  247. FUNCTION {new.block.checkb}
  248. { empty$
  249.   swap$ empty$
  250.   and
  251.     'skip$
  252.     'new.block
  253.   if$
  254. FUNCTION {new.sentence.checka}
  255. { empty$
  256.     'skip$
  257.     'new.sentence
  258.   if$
  259. FUNCTION {new.sentence.checkb}
  260. { empty$
  261.   swap$ empty$
  262.   and
  263.     'skip$
  264.     'new.sentence
  265.   if$
  266. FUNCTION {field.or.null}
  267. { duplicate$ empty$
  268.     { pop$ "" }
  269.     'skip$
  270.   if$
  271. FUNCTION {underline}
  272. { duplicate$ empty$
  273.   { pop$ "" }
  274.   { "\underline{" swap$ * "}" * }
  275.   if$
  276. % Emphasize the top string on the stack.
  277. FUNCTION {emphasize}
  278. { duplicate$ empty$
  279.     { pop$ "" }
  280.     { "{\em " swap$ * "}" * }
  281.   if$
  282. % Emphasize the top string on the stack, but add a trailing space.
  283. FUNCTION {emphasize.space}
  284. { duplicate$ empty$
  285.     { pop$ "" }
  286.     { "{\em " swap$ * "\/}" * }
  287.   if$
  288. INTEGERS { nameptr namesleft numnames }
  289. % Format bibliographical entries with the first author last name first,
  290. % and subsequent authors with initials followed by last name.
  291. % All names are formatted in this routine.
  292. FUNCTION {format.names}
  293. { 's :=
  294.   #1 'nameptr :=               % nameptr = 1;
  295.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  296.   numnames 'namesleft :=
  297.     { namesleft #0 > }
  298.     { nameptr #1 =
  299.         {s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := }
  300.         {s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
  301.       if$
  302.       nameptr #1 >
  303.         { namesleft #1 >
  304.               { ", " * t * }
  305.               { numnames #2 >
  306.                   { "," * }
  307.                   'skip$
  308.                 if$
  309.                 t "others" =
  310.                     { " et~al." * }
  311.                     { " and " * t * } % from Chicago Manual of Style
  312.                   if$
  313.                }
  314.                if$
  315.              }
  316.             't
  317.         if$
  318.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  319.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  320.     }
  321.   while$
  322. FUNCTION {my.full.label}
  323. { 's :=
  324.   #1 'nameptr :=               % nameptr = 1;
  325.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  326.   numnames 'namesleft :=
  327.     { namesleft #0 > }
  328.     { s nameptr "{vv~}{ll}" format.name$ 't :=  % get the next name
  329.       nameptr #1 >
  330.         { namesleft #1 >
  331.               { ", " * t * }
  332.               { numnames #2 >
  333.                   { "," * }
  334.                   'skip$
  335.                 if$
  336.                 t "others" =
  337.                     { " et~al." * }
  338.                     { " and " * t * } % from Chicago Manual of Style
  339.                   if$
  340.                }
  341.                if$
  342.              }
  343.             't
  344.         if$
  345.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  346.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  347.     }
  348.   while$
  349. FUNCTION {format.names.fml}
  350. % Format names in "familiar" format, with first initial followed by
  351. % last name. Like format.names, ALL names are formatted.
  352. { 's :=
  353.   #1 'nameptr :=               % nameptr = 1;
  354.   s num.names$ 'numnames :=    % numnames = num.name$(s);
  355.   numnames 'namesleft :=
  356.     { namesleft #0 > }
  357.     { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
  358.       nameptr #1 >
  359.         { namesleft #1 >
  360.               { ", " * t * }
  361.                { numnames #2 >
  362.                     { "," * }
  363.                     'skip$
  364.                   if$
  365.                   t "others" =
  366.                         { " et~al." * }
  367.                         { " and " * t * }
  368. %                       { " \& " * t * }
  369.                       if$
  370.                 }
  371.                if$
  372.              }
  373.             't
  374.         if$
  375.         nameptr #1 + 'nameptr :=          % nameptr += 1;
  376.         namesleft #1 - 'namesleft :=      % namesleft =- 1;
  377.     }
  378.   while$
  379. FUNCTION {format.annotation}
  380. { annotation empty$
  381.     { "" }
  382.     { " \begin{quotation}\noindent "
  383.       annotation
  384.       * " \end{quotation} " *
  385.       if$
  386. FUNCTION {format.authors}
  387. { author empty$
  388.     { "" }
  389.     { author format.names }
  390.   if$
  391. FUNCTION {format.key}
  392. { empty$
  393.     { key field.or.null }
  394.     { "" }
  395.   if$
  396. % Format editor names for use in the "in" types: inbook, incollection,
  397. % inproceedings: first initial, then last names. When editors are the
  398. % LABEL for an entry, then format.editor is used which lists editors
  399. % by last name first.
  400. FUNCTION {format.editors.fml}
  401. { editor empty$
  402.     { "" }
  403.     { editor format.names.fml
  404.       editor num.names$ #1 >
  405.     { " (Eds.)" * }
  406.     { " (Ed.)" * }
  407.       if$
  408.     }
  409.   if$
  410. % Format editor names for use in labels, last names first.
  411. FUNCTION {format.editors}
  412. { editor empty$
  413.     { "" }
  414.     { editor format.names
  415.       editor num.names$ #1 >
  416.     { " (Eds.)" * }
  417.     { " (Ed.)" * }
  418.       if$
  419.     }
  420.   if$
  421. FUNCTION {format.title}
  422. { title empty$
  423.     { "" }
  424.     { title "t" change.case$ }
  425.   if$
  426. % Note that the APA style requres case changes
  427. % in article titles. The following does not
  428. % change cases. If you perfer it, uncomment the
  429. % following and comment out the above.
  430. %FUNCTION {format.title}
  431. %{ title empty$
  432. %    { "" }
  433. %    { title }
  434. %  if$
  435. FUNCTION {n.dashify}
  436. { 't :=
  437.     { t empty$ not }
  438.     { t #1 #1 substring$ "-" =
  439.     { t #1 #2 substring$ "--" = not
  440.         { "--" *
  441.           t #2 global.max$ substring$ 't :=
  442.         }
  443.         {   { t #1 #1 substring$ "-" = }
  444.         { "-" *
  445.           t #2 global.max$ substring$ 't :=
  446.         }
  447.           while$
  448.         }
  449.       if$
  450.     }
  451.     { t #1 #1 substring$ *
  452.       t #2 global.max$ substring$ 't :=
  453.     }
  454.       if$
  455.     }
  456.   while$
  457. FUNCTION {format.btitle}
  458. { edition empty$
  459.   { title emphasize }
  460.   { title empty$
  461.     { title emphasize }
  462.     { volume empty$     % gnp - check for volume, then don't need period
  463.        { "{\em " title * "\/} (" * edition * " ed.)" * "." * }
  464.        { "{\em " title * "\/} (" * edition * " ed.)" * }
  465.       if$
  466.     }
  467.     if$
  468.   if$
  469. FUNCTION {format.emphasize.booktitle}
  470. { edition empty$
  471.   { booktitle emphasize }
  472.   { booktitle empty$
  473.     { booktitle emphasize }
  474.     { volume empty$    % gnp - extra period an error if book has a volume
  475.         { "{\em " booktitle * "\/} (" * edition * " ed.)" * "." *}
  476.         { "{\em " booktitle * "\/} (" * edition * " ed.)" * }
  477.       if$
  478.       }
  479.     if$
  480.     }
  481.   if$
  482. FUNCTION {tie.or.space.connect}
  483. { duplicate$ text.length$ #3 <
  484.     { "~" }
  485.     { " " }
  486.   if$
  487.   swap$ * *
  488. FUNCTION {either.or.check}
  489. { empty$
  490.     'pop$
  491.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  492.   if$
  493. FUNCTION {format.bvolume}
  494. { volume empty$
  495.     { "" }
  496.     { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  497.       series empty$
  498.         'skip$
  499.         { " of " * series emphasize * }
  500.       if$
  501.       "volume and number" number either.or.check
  502.     }
  503.   if$
  504. FUNCTION {format.number.series}
  505. { volume empty$
  506.     { number empty$
  507.     { series field.or.null }
  508.     { output.state mid.sentence =
  509.         { "Number" } % gnp - changed to mixed case always
  510.         { "Number" }
  511.       if$
  512.       number tie.or.space.connect
  513.       series empty$
  514.         { " number but no series in " cite$ * warning$ }
  515.         { " in " * series * }
  516.       if$
  517.     }
  518.       if$
  519.     }
  520.     { "" }
  521.   if$
  522. INTEGERS { multiresult }
  523. FUNCTION {multi.page.check}
  524. { 't :=
  525.   #0 'multiresult :=
  526.     { multiresult not
  527.       t empty$ not
  528.       and
  529.     }
  530.     { t #1 #1 substring$
  531.       duplicate$ "-" =
  532.       swap$ duplicate$ "," =
  533.       swap$ "+" =
  534.       or or
  535.     { #1 'multiresult := }
  536.     { t #2 global.max$ substring$ 't := }
  537.       if$
  538.     }
  539.   while$
  540.   multiresult
  541. FUNCTION {format.pages}
  542. { pages empty$
  543.   { "" }
  544.   { pages multi.page.check
  545.     { "pp.\ " pages n.dashify tie.or.space.connect } % gnp - removed ()
  546.     { "pp.\ " pages tie.or.space.connect }
  547.     if$
  548.   if$
  549. % By Young (and Spencer)
  550. % GNP - fixed bugs with missing volume, number, and/or pages
  551. % Format journal, volume, number, pages for article types.
  552. FUNCTION {format.jour.vol}
  553. { journal empty$
  554.     { "no journal in " cite$ * warning$
  555.       "" }
  556.     { journal emphasize.space " " * }
  557.     if$
  558.   number empty$
  559.     { volume empty$
  560.        { "no number and no volume in " cite$ * warning$
  561.          "" * }
  562.        { "{\em " * Volume * "}" * }
  563.       if$
  564.     }
  565.     { volume empty$
  566.       {"no volume for " cite$ * warning$
  567.        "(" * number * ")" * }
  568.       { volume emphasize.space
  569.         "(" * number * ")" * * }
  570.       if$
  571.     }
  572.   if$
  573.   pages empty$
  574.     {"page numbers missing in " cite$ * warning$
  575.      "" } % gnp - place a null string on the stack for output
  576.     { duplicate$ empty$
  577.       { pop$ format.pages }
  578.       { ", " *  pages n.dashify * } % gnp - removed pp. for articles
  579.       if$
  580.     }
  581.   if$
  582. FUNCTION {format.chapter.pages}
  583. { chapter empty$
  584.     'format.pages
  585.     { type empty$
  586.         { "Chapter" } % gnp - changed to mixed case
  587.         { type "t" change.case$ }
  588.       if$
  589.       chapter tie.or.space.connect
  590.       pages empty$
  591.         {""}
  592.         { ", " * format.pages * }
  593.       if$
  594.     }
  595.   if$
  596. FUNCTION {format.in.ed.booktitle}
  597. { booktitle empty$
  598.   { "" }
  599.   { editor empty$
  600.     { "In " format.emphasize.booktitle * }
  601.     { "In " format.editors.fml * ", " * format.emphasize.booktitle * }
  602.     if$
  603.   if$
  604. FUNCTION {format.thesis.type}
  605. { type empty$
  606.     'skip$
  607.     { pop$
  608.       type "t" change.case$
  609.     }
  610.   if$
  611. FUNCTION {format.tr.number}
  612. { type empty$
  613.     { "Technical Report" }
  614.     'type
  615.   if$
  616.   number empty$
  617.     { "t" change.case$ }
  618.     { number tie.or.space.connect }
  619.   if$
  620. FUNCTION {format.article.crossref}
  621. { "See"
  622.   "\citeN{" * crossref * "}" *
  623. FUNCTION {format.crossref.editor}
  624. { editor #1 "{vv~}{ll}" format.name$
  625.   editor num.names$ duplicate$
  626.   #2 >
  627.     { pop$ " et~al." * }
  628.     { #2 <
  629.     'skip$
  630.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  631.         { " et~al." * }
  632.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  633.       if$
  634.     }
  635.       if$
  636.     }
  637.   if$
  638. FUNCTION {format.book.crossref}
  639. { volume empty$
  640.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  641.       "In "
  642.     }
  643.     { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  644.       " of " *
  645.     }
  646.   if$
  647.   editor empty$
  648.   editor field.or.null author field.or.null =
  649.     { key empty$
  650.     { series empty$
  651.         { "need editor, key, or series for " cite$ * " to crossref " *
  652.           crossref * warning$
  653.           "" *
  654.         }
  655.         { "{\em " * series * "\/}" * }
  656.       if$
  657.     }
  658.     { key * }
  659.       if$
  660.     }
  661.     { format.crossref.editor * }
  662.   if$
  663.   " \citeN{" * crossref * "}" *
  664. FUNCTION {format.incoll.inproc.crossref}
  665. { "See"
  666.   " \citeN{" * crossref * "}" *
  667. FUNCTION {article}
  668. { output.bibitem
  669.   format.authors
  670.   "author" output.check
  671.   author format.key output          % added
  672.   output.year.check                 % added
  673.   new.block
  674.   format.title
  675.   "title" output.check
  676.   new.block
  677.   crossref missing$
  678.     { format.jour.vol output
  679.     }
  680.     { format.article.crossref output.nonnull
  681.       format.pages output
  682.     }
  683.   if$
  684.   new.block
  685.   note output
  686.   fin.entry
  687.   format.annotation write$
  688.   newline$
  689. FUNCTION {book}
  690. { output.bibitem
  691.   author empty$
  692.     { format.editors
  693.       "author and editor" output.check }
  694.     { format.authors
  695.       output.nonnull
  696.       crossref missing$
  697.         { "author and editor" editor either.or.check }
  698.         'skip$
  699.       if$
  700.     }
  701.   if$
  702.   output.year.check       % added
  703.   new.block
  704.   format.btitle
  705.   "title" output.check
  706.   crossref missing$
  707.     { format.bvolume output
  708.       new.block
  709.       format.number.series output
  710.       new.sentence
  711.       address output
  712.       publisher "publisher" output.check.colon
  713.     }
  714.     { new.block
  715.       format.book.crossref output.nonnull
  716.     }
  717.   if$
  718.   new.block
  719.   note output
  720.   fin.entry
  721.   format.annotation write$
  722.   newline$
  723. FUNCTION {booklet}
  724. { output.bibitem
  725.   format.authors output
  726.   author format.key output          % added
  727.   output.year.check                 % added
  728.   new.block
  729.   format.title
  730.   "title" output.check
  731.   new.block
  732.   howpublished output
  733.   address output
  734.   new.block
  735.   note output
  736.   fin.entry
  737.   format.annotation write$
  738. FUNCTION {inbook}
  739. { output.bibitem
  740.   author empty$
  741.     { format.editors
  742.       "author and editor" output.check
  743.     }
  744.     { format.authors output.nonnull
  745.       crossref missing$
  746.     { "author and editor" editor either.or.check }
  747.     'skip$
  748.       if$
  749.     }
  750.   if$
  751.   output.year.check                 % added
  752.   new.block
  753.   format.btitle
  754.   "title" output.check
  755.   crossref missing$
  756.     { format.bvolume output
  757.       format.chapter.pages
  758.       "chapter and pages" output.check
  759.       new.block
  760.       format.number.series output
  761.       new.sentence
  762.       address output
  763.       publisher
  764.       "publisher" output.check.colon
  765.     }
  766.     { format.chapter.pages "chapter and pages" output.check
  767.       new.block
  768.       format.book.crossref output.nonnull
  769.     }
  770.   if$
  771.   new.block
  772.   note output
  773.   fin.entry
  774.   format.annotation write$
  775. FUNCTION {incollection}
  776. { output.bibitem
  777.   format.authors
  778.   "author" output.check
  779.   author format.key output       % added
  780.   output.year.check              % added
  781.   new.block
  782.   format.title
  783.   "title" output.check
  784.   new.block
  785.   crossref missing$
  786.   { format.in.ed.booktitle
  787.     "booktitle" output.check
  788.     format.bvolume output
  789.     format.number.series output
  790.     format.chapter.pages output % gnp - was special.output.nonnull
  791. %                                 left out comma before page numbers
  792.     new.sentence
  793.     address output
  794.     publisher "publisher" output.check.colon
  795.   { format.incoll.inproc.crossref
  796.     output.nonnull
  797.     format.chapter.pages output
  798.   if$
  799.   new.block
  800.   note output
  801.   fin.entry
  802.   format.annotation write$
  803. FUNCTION {inproceedings}
  804. { output.bibitem
  805.   format.authors
  806.   "author" output.check
  807.   author format.key output            % added
  808.   output.year.check                   % added
  809.   new.block
  810.   format.title
  811.   "title" output.check
  812.   new.block
  813.   crossref missing$
  814.     { format.in.ed.booktitle
  815.       "booktitle" output.check
  816.       format.bvolume output
  817.       format.number.series output
  818.       address output
  819.       format.pages output
  820.       new.sentence
  821.       organization output
  822.       publisher output.colon
  823.     }
  824.     { format.incoll.inproc.crossref output.nonnull
  825.       format.pages output
  826.     }
  827.   if$
  828.   new.block
  829.   note output
  830.   fin.entry
  831.   format.annotation write$
  832. FUNCTION {conference} { inproceedings }
  833. FUNCTION {manual}
  834. { output.bibitem
  835.   author empty$
  836.     { editor empty$
  837.       { organization "organization" output.check
  838.         organization format.key output }  % if all else fails, use key
  839.       { format.editors "author and editor" output.check }
  840.       if$
  841.     }
  842.     { format.authors output.nonnull }
  843.     if$
  844.   output.year.check                 % added
  845.   new.block
  846.   format.btitle
  847.   "title" output.check
  848.   organization address new.block.checkb
  849. % Reversed the order of "address" and "organization", added the ":".
  850.   address output
  851.   organization "organization" output.check.colon
  852. %  address output
  853. %  ":" output
  854. %  organization output
  855.   new.block
  856.   note output
  857.   fin.entry
  858.   format.annotation write$
  859. FUNCTION {mastersthesis}
  860. { output.bibitem
  861.   format.authors
  862.   "author" output.check
  863.   author format.key output          % added
  864.   output.year.check                 % added
  865.   new.block
  866.   format.title
  867.   "title" output.check
  868.   new.block
  869.   "Master's thesis" format.thesis.type output.nonnull
  870.   school "school" output.check
  871.   address output
  872.   new.block
  873.   note output
  874.   fin.entry
  875.   format.annotation write$
  876. FUNCTION {misc}
  877. { output.bibitem
  878.   format.authors output
  879.   author format.key output            % added
  880.   output.year.check                   % added
  881.   title howpublished new.block.checkb
  882.   format.title output
  883.   new.block
  884.   howpublished output
  885.   new.block
  886.   note output
  887.   fin.entry
  888.   format.annotation write$
  889. FUNCTION {phdthesis}
  890. { output.bibitem
  891.   format.authors
  892.   "author" output.check
  893.   author format.key output            % added
  894.   output.year.check                   % added
  895.   new.block
  896.   format.btitle
  897.   "title" output.check
  898.   new.block
  899.   "Ph.\ D. thesis" format.thesis.type output.nonnull
  900.   school "school" output.check
  901.   address output
  902.   new.block
  903.   note output
  904.   fin.entry
  905.   format.annotation write$
  906. FUNCTION {proceedings}
  907. { output.bibitem
  908.   editor empty$
  909.     { organization output
  910.       organization format.key output }  % gnp - changed from author format.key
  911.     { format.editors output.nonnull }
  912.   if$
  913. % author format.key output             % gnp - removed (should be either
  914. %                                        editor or organization
  915.   output.year.check                    % added (newapa)
  916.   new.block
  917.   format.btitle
  918.   "title" output.check
  919.   format.bvolume output
  920.   format.number.series output
  921.   address output
  922.   new.sentence
  923.   organization output
  924.   publisher output.colon
  925.   new.block
  926.   note output
  927.   fin.entry
  928.   format.annotation write$
  929. FUNCTION {techreport}
  930. { output.bibitem
  931.   format.authors
  932.   "author" output.check
  933.   author format.key output             % added
  934.   output.year.check                    % added
  935.   new.block
  936.   format.title
  937.   "title" output.check
  938.   new.block
  939.   format.tr.number output.nonnull
  940.   institution
  941.   "institution" output.check
  942.   address output
  943.   new.block
  944.   note output
  945.   fin.entry
  946.   format.annotation write$
  947. FUNCTION {unpublished}
  948. { output.bibitem
  949.   format.authors
  950.   "author" output.check
  951.   author format.key output              % added
  952.   output.year.check                      % added
  953.   new.block
  954.   format.title
  955.   "title" output.check
  956.   new.block
  957.   note "note" output.check
  958.   fin.entry
  959.   format.annotation write$
  960. FUNCTION {default.type} { misc }
  961. MACRO {jan} {"January"}
  962. MACRO {feb} {"February"}
  963. MACRO {mar} {"March"}
  964. MACRO {apr} {"April"}
  965. MACRO {may} {"May"}
  966. MACRO {jun} {"June"}
  967. MACRO {jul} {"July"}
  968. MACRO {aug} {"August"}
  969. MACRO {sep} {"September"}
  970. MACRO {oct} {"October"}
  971. MACRO {nov} {"November"}
  972. MACRO {dec} {"December"}
  973. MACRO {acmcs} {"ACM Computing Surveys"}
  974. MACRO {acta} {"Acta Informatica"}
  975. MACRO {ai} {"Artificial Intelligence"}
  976. MACRO {cacm} {"Communications of the ACM"}
  977. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  978. MACRO {ibmsj} {"IBM Systems Journal"}
  979. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  980. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  981. MACRO {ieeetcad}
  982.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  983. MACRO {ipl} {"Information Processing Letters"}
  984. MACRO {jacm} {"Journal of the ACM"}
  985. MACRO {jcss} {"Journal of Computer and System Sciences"}
  986. MACRO {scp} {"Science of Computer Programming"}
  987. MACRO {sicomp} {"SIAM Journal on Computing"}
  988. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  989. MACRO {tods} {"ACM Transactions on Database Systems"}
  990. MACRO {tog} {"ACM Transactions on Graphics"}
  991. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  992. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  993. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  994. MACRO {tcs} {"Theoretical Computer Science"}
  995. FUNCTION {sortify}
  996. { purify$
  997.   "l" change.case$
  998. INTEGERS { len }
  999. FUNCTION {chop.word}
  1000. { 's :=
  1001.   'len :=
  1002.   s #1 len substring$ =
  1003.     { s len #1 + global.max$ substring$ }
  1004.     's
  1005.   if$
  1006. % format.lab.names:
  1007. % determines "short" names for the abbreviated author information.
  1008. % "Long" labels are created in calc.label, using the routine my.full.label
  1009. % to format author and editor fields.
  1010. % There are 4 cases for labels.   (n=3 in the example)
  1011. % a) one author             Foo
  1012. % b) one to n               Foo, Bar and Baz
  1013. % c) use of "and others"    Foo, Bar et al.
  1014. % d) more than n            Foo et al.
  1015. FUNCTION {format.lab.names}
  1016. { 's :=
  1017.   s num.names$ 'numnames :=
  1018.   numnames #2 >    % change number to number of others allowed before
  1019.            % forcing "et al".
  1020.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  1021.     {
  1022.       numnames #1 - 'namesleft :=
  1023.       #2 'nameptr :=
  1024.       s #1 "{vv~}{ll}" format.name$
  1025.     { namesleft #0 > }
  1026.     { nameptr numnames =
  1027.         { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1028.         { " et~al." * }
  1029.         { " and " * s nameptr "{vv~}{ll}" format.name$ * }
  1030.           if$
  1031.         }
  1032.         { ", " * s nameptr "{vv~}{ll}" format.name$ * }
  1033.       if$
  1034.       nameptr #1 + 'nameptr :=
  1035.       namesleft #1 - 'namesleft :=
  1036.       while$
  1037.     }
  1038.   if$
  1039. FUNCTION {author.key.label}
  1040. { author empty$
  1041.     { key empty$
  1042.           { "no key, author in " cite$ * warning$
  1043.             cite$ #1 #3 substring$ }
  1044.          'key
  1045.       if$
  1046.     }
  1047.     { author format.lab.names }
  1048.   if$
  1049. FUNCTION {editor.key.label}
  1050. { editor empty$
  1051.     { key empty$
  1052.           { "no key, ed. in " cite$ * warning$
  1053.             cite$ #1 #3 substring$ }
  1054.           'key
  1055.         if$
  1056.      }
  1057.      { editor format.lab.names }
  1058.   if$
  1059. FUNCTION {author.key.organization.label}
  1060. % added - gnp. Provide label formatting by organization if author is null.
  1061. { author empty$
  1062.     { organization empty$
  1063.     { key empty$
  1064.         { "no key, author or org. in " cite$ * warning$
  1065.               cite$ #1 #3 substring$ }
  1066.         'key
  1067.       if$
  1068.         { organization text.length$ #30 >
  1069.           { "org. too long, using key= in " cite$ * warning$
  1070.             key }
  1071.           { organization }
  1072.           if$
  1073.         }
  1074.       if$
  1075.     }
  1076.     { author format.lab.names }
  1077.   if$
  1078. FUNCTION {editor.key.organization.label}
  1079. % added - gnp. Provide label formatting by organization if editor is null.
  1080. { editor empty$
  1081.     { organization empty$
  1082.     { key empty$
  1083.         { "no key, editor or org. in " cite$ * warning$
  1084.               cite$ #1 #3 substring$ }
  1085.         'key
  1086.       if$
  1087.         { organization text.length$ #30 >
  1088.           { "org. too long, using key= in " cite$ * warning$
  1089.             key }
  1090.           { organization }
  1091.           if$
  1092.         }
  1093.       if$
  1094.     }
  1095.     { editor format.lab.names }
  1096.   if$
  1097. FUNCTION {author.editor.key.label}
  1098. { author empty$
  1099.     { editor empty$
  1100.           { key empty$
  1101.                { "no key, author, or editor in " cite$ * warning$
  1102.                  cite$ #1 #3 substring$ }
  1103.              'key
  1104.            if$
  1105.          }
  1106.           { editor format.lab.names }
  1107.       if$
  1108.     }
  1109.     { author format.lab.names }
  1110.   if$
  1111. FUNCTION {calc.label}
  1112. % Changed - GNP. See also author.organization.sort, editor.organization.sort
  1113. % Form label for BibTeX entry. The classification of which fields are used
  1114. % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
  1115. % The change here from newapa is to also include organization as a
  1116. % citation label if author or editor is missing.
  1117. { type$ "book" =
  1118.   type$ "inbook" =
  1119.     'author.editor.key.label
  1120.     { type$ "proceedings" =
  1121.     'editor.key.organization.label
  1122.     { type$ "manual" =
  1123.         'author.key.organization.label
  1124.         'author.key.label
  1125.       if$
  1126.       if$
  1127.     }
  1128.   if$
  1129.   duplicate$
  1130.   author empty$  % generate the full label citation information.
  1131.     { editor empty$
  1132.         { organization empty$
  1133.            { "no author, ed., org. for label in " cite$ * warning$
  1134.              "??" }
  1135.            { organization }
  1136.            if$
  1137.         }
  1138.         { editor my.full.label }
  1139.         if$
  1140.     }
  1141.     { author my.full.label }
  1142.   if$
  1143.   "\protect\citeauthoryear{" swap$ * "}{" * swap$ * "}{" *
  1144.   year field.or.null purify$ #-1 #4 substring$ *
  1145.   'label :=
  1146.   year field.or.null purify$ #-1 #4 substring$ *
  1147.   sortify 'sort.label :=
  1148. FUNCTION {sort.format.names}
  1149. { 's :=
  1150.   #1 'nameptr :=
  1151.   s num.names$ 'numnames :=
  1152.   numnames 'namesleft :=
  1153.     { namesleft #0 > }
  1154.     { nameptr #1 >
  1155.           { "   " * }
  1156.          'skip$
  1157.       if$
  1158.       s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't :=
  1159.       nameptr numnames = t "others" = and
  1160.           { " et al}" * }
  1161.           { t sortify * }
  1162.       if$
  1163.       nameptr #1 + 'nameptr :=
  1164.       namesleft #1 - 'namesleft :=
  1165.     }
  1166.   while$
  1167. FUNCTION {sort.format.title}
  1168. { 't :=
  1169.   "A " #2
  1170.     "An " #3
  1171.       "The " #4 t chop.word
  1172.     chop.word
  1173.   chop.word
  1174.   sortify
  1175.   #1 global.max$ substring$
  1176. FUNCTION {author.sort}
  1177. { author empty$
  1178.     { key empty$
  1179.          { "to sort, need author or key in " cite$ * warning$
  1180.            "" }
  1181.          { key sortify }
  1182.       if$
  1183.     }
  1184.     { author sort.format.names }
  1185.   if$
  1186. FUNCTION {editor.sort}
  1187. { editor empty$
  1188.     { key empty$
  1189.          { "to sort, need editor or key in " cite$ * warning$
  1190.            ""
  1191.          }
  1192.          { key sortify }
  1193.       if$
  1194.     }
  1195.     { editor sort.format.names }
  1196.   if$
  1197. FUNCTION {author.editor.sort}
  1198. { author empty$
  1199.     { "missing author in " cite$ * warning$
  1200.       editor empty$
  1201.          { key empty$
  1202.              { "to sort, need author, editor, or key in " cite$ * warning$
  1203.                ""
  1204.              }
  1205.              { key sortify }
  1206.            if$
  1207.          }
  1208.          { editor sort.format.names }
  1209.       if$
  1210.     }
  1211.     { author sort.format.names }
  1212.   if$
  1213. FUNCTION {author.organization.sort}
  1214. % added - GNP. Stack author or organization for sorting (from alpha.bst).
  1215. % Unlike alpha.bst, we need entire names, not abbreviations
  1216. { author empty$
  1217.     { organization empty$
  1218.     { key empty$
  1219.         { "to sort, need author, org., or key in " cite$ * warning$
  1220.           ""
  1221.         }
  1222.         { key sortify }
  1223.       if$
  1224.     { organization sortify }
  1225.       if$
  1226.     }
  1227.     { author sort.format.names }
  1228.   if$
  1229. FUNCTION {editor.organization.sort}
  1230. % added - GNP. Stack editor or organization for sorting (from alpha.bst).
  1231. % Unlike alpha.bst, we need entire names, not abbreviations
  1232. { editor empty$
  1233.     { organization empty$
  1234.     { key empty$
  1235.         { "to sort, need editor, org., or key in " cite$ * warning$
  1236.           ""
  1237.         }
  1238.         { key sortify }
  1239.       if$
  1240.     { organization sortify }
  1241.       if$
  1242.     }
  1243.     { editor sort.format.names }
  1244.   if$
  1245. FUNCTION {presort}
  1246. % Presort creates the bibentry's label via a call to calc.label, and then
  1247. % sorts the entries based on entry type. Chicago.bst adds support for
  1248. % including organizations as the sort key; the following is stolen from
  1249. % alpha.bst.
  1250. { calc.label
  1251.   label sortify
  1252.   "    "
  1253.   type$ "book" =
  1254.   type$ "inbook" =
  1255.     'author.editor.sort
  1256.     { type$ "proceedings" =
  1257.     'editor.organization.sort
  1258.     { type$ "manual" =
  1259.         'author.organization.sort
  1260.         'author.sort
  1261.       if$
  1262.       if$
  1263.     }
  1264.   if$
  1265.   #1 entry.max$ substring$        % added for newapa
  1266.   'sort.label :=                  % added for newapa
  1267.   sort.label                      % added for newapa
  1268.   "    "
  1269.   title field.or.null
  1270.   sort.format.title
  1271.   #1 entry.max$ substring$
  1272.   'sort.key$ :=
  1273. ITERATE {presort}
  1274. SORT             % by label, sort.label, title --- for final label calculation
  1275. STRINGS { last.label next.extra }
  1276. INTEGERS { last.extra.num }
  1277. FUNCTION {initialize.extra.label.stuff}
  1278. { #0 int.to.chr$ 'last.label :=
  1279.   "" 'next.extra :=
  1280.   #0 'last.extra.num :=
  1281. FUNCTION {forward.pass}
  1282. { last.label label =
  1283.      { last.extra.num #1 + 'last.extra.num :=
  1284.        last.extra.num int.to.chr$ 'extra.label :=
  1285.      }
  1286.      { "a" chr.to.int$ 'last.extra.num :=
  1287.        "" 'extra.label :=
  1288.        label 'last.label :=
  1289.     }
  1290.   if$
  1291. FUNCTION {reverse.pass}
  1292. { next.extra "b" =
  1293.     { "a" 'extra.label := }
  1294.      'skip$
  1295.   if$
  1296.   label extra.label * "}" * 'label :=
  1297.   extra.label 'next.extra :=
  1298. EXECUTE {initialize.extra.label.stuff}
  1299. ITERATE {forward.pass}
  1300. REVERSE {reverse.pass}
  1301. FUNCTION {bib.sort.order}
  1302. { sort.label
  1303.   "    "
  1304.   year field.or.null sortify
  1305.   "    "
  1306.   title field.or.null
  1307.   sort.format.title
  1308.   #1 entry.max$ substring$
  1309.   'sort.key$ :=
  1310. ITERATE {bib.sort.order}
  1311. SORT             % by sort.label, year, title --- giving final bib. order.
  1312. FUNCTION {begin.bib}
  1313. { preamble$ empty$
  1314.     'skip$
  1315.     { preamble$ write$ newline$ }
  1316.   if$
  1317.   "\begin{thebibliography}{}" write$ newline$
  1318. EXECUTE {begin.bib}
  1319. EXECUTE {init.state.consts}
  1320. ITERATE {call.type$}
  1321. FUNCTION {end.bib}
  1322. { newline$
  1323.   "\end{thebibliography}" write$ newline$
  1324. EXECUTE {end.bib}
  1325.